const state = () => ({
  menu: [],
  hotPlace: []
})

const mutations = {
  setMenu: (state, val) => {
    state.menu = val
  },
  //可以简写
  setHotPlace(state, val) {
    state.hotPlace = val
  }
}

const actions = {
  setMenu({ commit }, menu) {
    commit('setMenu', menu) //格式data: { menu }
  },
  setHotPlace({ commit }, hotPlace) {
    commit('setHotPlace', hotPlace) //格式data: { result }
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
